package management;

import java.io.Serializable;

/**
 * 学生实体类，包含学号、姓名、班级
 */
public class Student implements Serializable {
    private String studentId;  // 学号（唯一标识）
    private String name;       // 姓名
    private String className;  // 班级

    public Student(String studentId, String name, String className) {
        this.studentId = studentId;
        this.name = name;
        this.className = className;
    }

    // Getter方法
    public String getStudentId() { return studentId; }
    public String getName() { return name; }
    public String getClassName() { return className; }

    // 重写toString：显示学号、姓名、班级
    @Override
    public String toString() {
        return "[" + studentId + "] " + name + "（" + className + "）";
    }

    // 以学号作为唯一标识
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        Student student = (Student) obj;
        return studentId.equals(student.studentId);
    }

    @Override
    public int hashCode() {
        return studentId.hashCode();
    }
}